import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import '../page/drawer/my_drawer.dart';

class HomePage extends StatelessWidget {
  HomePage({Key? key}) : super(key: key);
  final List<String> pages = [
    'Fluro Demo',
    'provider - counter',
    'Quiz Page',
    'Widget List',
    'Native View',
  ];
  final List<String> routeNames = [
    '/counterPage',
    '/quizPage',
    '/widgetList',
    '/nativePage',
    '/dialog_page',
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Flutter Example"),
      ),
      drawer: const MyDrawer(),
      body: Material(
        color: const Color.fromRGBO(245, 245, 245, 0),
        child: ListView.builder(
          itemBuilder: (context, index) {
            return Column(
              children: [
                ListTile(
                  leading: CircleAvatar(child: Text(pages.elementAt(index)[0]), backgroundColor: Colors.lightGreen),
                  trailing: const Icon(Icons.arrow_forward_ios, color: Color.fromRGBO(192, 192, 192, 0.5)),
                  title: Text(pages.elementAt(index), style: const TextStyle(color: Colors.black87)),
                  onTap: () => FluroRouter.appRouter.navigateTo(context, routeNames.elementAt(index), transition: TransitionType.native),
                ),
                const Divider(color: Color.fromRGBO(153, 153, 153, 0.3), height: 1),
              ]
            );
          },
          itemCount: pages.length,
        ),
      ),
    );
  }
}